package com.yp.infrastructure.axon.interceptor;

import com.yp.infrastructure.axon.constants.EnumErrorMessage;
import com.yp.infrastructure.axon.exception.AxonException;
import com.yp.infrastructure.common.exception.BaseException;

public abstract class BaseMessageHandlerInterceptor {

    protected Object detail(Throwable throwable) {
        if (throwable instanceof BaseException) {
            return throwable;
        }
        return new AxonException(EnumErrorMessage.AXON_ERROR);
    }
}
